-- challengeVo
-- Author: mm
-- Date: 2018-03-19 15:59:54
-- 公会挑战数据结构

local fileName = string.getModeName(...)
local ClassRef = class(fileName)

-- // 公会挑战信息
-- message GuildChallengeInfo {
-- int32 id = 1;                       // 挑战任务id
-- int32 condition1Par2 = 2;           // 当前完成进度
-- int32 state = 3;                    // 完成状态
-- bool getReward = 4;                 // 是否已领奖
-- int32 myProgress = 5;			   // 我的任务进度（只有当我的进度达到guild_challenge表中effectiveTime设定值，才会推进condition1Par2）
-- }

function ClassRef:ctor(data)
	self._id = 0 				-- guild_challenge.ID

	self._condition1Par2 = 0
	self._state = 0 			-- 任务状态(0-任务未解锁 1-任务进行中 2-任务已完成 3-任务已领奖 4-任务已挂起)
	self._getReward = false

	if data then
		self:read(data)
	end
end

function ClassRef:read(data)
	self._id = data.id

	self._condition1Par2 = data.condition1Par2
	self._state = data.state
	self._getReward = data.getReward
	self._myProgress = data.myProgress
	self._needProgress = data.needProgress

	self._gameDB = GD:queryGuildChallengeById( self._id )
	assert( self._gameDB, " ------------>>>> challengeVo gameDB 不可为空" )
end

function ClassRef:getId()
	return self._id
end

function ClassRef:getChallengeName()
	return L(self._gameDB.name)
end
function ClassRef:getChallengeQuality()
	return self._gameDB.quality
end
function ClassRef:getChallengeIcon()
	return GD:getImagePath(Res.taskIconPath, self._gameDB.icon)
end
function ClassRef:getChallengeQualityIcon()
	return Res.Qulity_Icon_BgPoint[self._gameDB.quality]
end
function ClassRef:getChallengeDesc()
	return L(self._gameDB.target)
end
-- 返回 当前任务 完成条件
function ClassRef:getCompleteProcessMax()
	return tonumber( self._needProgress )
end

-- 返回 当前完成进度
function ClassRef:getCompleteProcess()
	return self._condition1Par2
end
-- 是否完成？
function ClassRef:isCompleted()
	return self._state == 2
end
-- 是否已领奖？
function ClassRef:hadGotReward()
	return self._getReward
end
-- 返回这个挑战数据中我贡献的进度
function ClassRef:getMyProcess()
	return self._myProgress
end
-- 返回这个挑战数据中我可以贡献的最大值
function ClassRef:getMyMaxProcess()
	return self._gameDB.effectiveTime
end

return ClassRef
